package com.ruoyi.inspection.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.inspection.domain.GovernCheckTaskInfo;
import com.ruoyi.inspection.domain.GovernCheckTaskPlan;
import com.ruoyi.inspection.domain.GovernCheckTaskPlanItem;
import com.ruoyi.inspection.utils.IdFactory;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 专项任务计划检查项表(GovernCheckTaskPlanItem)实体类
 *
 * @author makejava
 * @since 2024-06-19 16:16:21
 */
@Data
public class GovernCheckTaskPlanItemVo implements Serializable {
    private static final long serialVersionUID = -11646347619032502L;

    // 政府专项检查ID
    @JsonSerialize(using= ToStringSerializer.class)
    private Long governTaskInfoId;
    // 任务名称
    private String governCheckTaskName;
    // 计划开始时间
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date governTaskStartTime;
    // 计划结束时间
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date governTaskEndTime;
    // 任务类型
    private String governTaskTypeName;
    // 检查任务类型
    private String governCheckTaskTypeName;
    // 涉及危险源
    private String governInvolveDanger;
    // 涉及危险源编码
    private String governInvolveDangerCode;
    // 检查单位
    private String governCheckCompany;
    // 检查来源
    private String governCheckSource;
    // 检查来源
    private String governTaskContent;
    // 检查范围(企业自主检查)
    private String checkRange;
    // 检查种类(企业自主检查)
    private String checkKind;
    // 被检查部门(企业自主检查)
    private String checkedCompany;
    // 备注(企业自主检查)
    private String remark;
    // 任务完成时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date governTaskCompleteTime;
    // 任务登记时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date governTaskRegisterTime;
    // 检查级别
    private String governCheckLevel;

    // 计划ID
    @JsonSerialize(using= ToStringSerializer.class)
    private Long governTaskPlanId;
    // 专项检查子任务ID
    @JsonSerialize(using= ToStringSerializer.class)
    @Excel(name = "编号")
    private Long governTaskPlanItemId;
    // 专项名称
    @Excel(name = "专项名称")
    private String governCheckName;
    // 专项检查内容
    @Excel(name = "检查内容")
    private String governCheckContent;
    // 专项检查方式
    @Excel(name = "检查方式")
    private String governCheckWay;
    // 专项检查依据
    private String governCheckBasis;
    // 专项检查适用场合
    @Excel(name = "适用场合")
    private String governApplicablePlace;
    // 检查时间
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date governCheckTime;
    // 检查结果 未排查、已排查
    private String governCheckResult;
    // 是否符合（0符合 1不符合）
    private Integer governCheckConform;
    // 检查人员
    @Excel(name = "检查人员，多个检查人间，用英文逗号隔开")
    private String governCheckUserName;
    private String governCheckUserId;


    public void setTaskInfo(GovernCheckTaskPlan taskPlan, GovernCheckTaskInfo taskInfo) {
        this.setGovernTaskInfoId(taskInfo.getGovernTaskInfoId());
        this.setGovernCheckTaskName(taskInfo.getGovernCheckTaskName());
        this.setGovernTaskStartTime(taskInfo.getGovernTaskStartTime());
        this.setGovernTaskEndTime(taskInfo.getGovernTaskEndTime());
        this.setGovernTaskTypeName(taskInfo.getGovernTaskTypeName());
        this.setGovernCheckTaskTypeName(taskInfo.getGovernCheckTaskTypeName());
        this.setGovernInvolveDanger(taskPlan.getGovernInvolveDanger());
        this.setGovernInvolveDangerCode(taskPlan.getGovernInvolveDangerCode());
        this.setGovernCheckCompany(taskPlan.getGovernCheckCompany());
        this.setGovernCheckSource(taskPlan.getGovernCheckSource());
        this.setGovernTaskContent(taskInfo.getGovernTaskContent());
    }

    public GovernCheckTaskPlanItemVo pojoToVo(GovernCheckTaskPlanItem item) {
        this.setGovernCheckWay(item.getGovernCheckWay());
        this.setGovernCheckName(item.getGovernCheckName());
        this.setGovernCheckContent(item.getGovernCheckContent());
        this.setGovernApplicablePlace(StringUtils.isEmpty(item.getGovernApplicablePlace()) ? "" : item.getGovernApplicablePlace());
        this.setGovernCheckUserName(StringUtils.isEmpty(item.getGovernCheckUserName()) ? "" : item.getGovernCheckUserName());
        this.setGovernTaskPlanItemId(item.getGovernTaskPlanItemId());

        return this;
    }
}

